/* eslint  react/no-string-refs: 0 */
import React, { Component } from 'react';
import { Link } from 'react-router-dom';
import moment from 'moment';
import { Grid, Table, Button, Icon } from '@alifd/next';
import IconSvg from '#/components/IconSvg';
import styles from './styles/styles';
import axios from 'axios'
import { ApiOfGatewayBatchEnable, ApiOfGatewayBatchDisable } from '#/utils/coreApiDefine'

const { Row, Col } = Grid;
export default class Status extends Component {
  static displayName = 'Status';

  static propTypes = {};

  static defaultProps = {};

  constructor(props) {
    super(props);
    this.state = {
      baseInfo: {
        code: '',
        disabled: true,
        batched: false,
      },
    };
  }

  componentWillReceiveProps(nextProps) {
    this.setState({
      baseInfo: nextProps.baseInfo,
    })    
  }

  componentWillMount() {
    
  }

  onToggleBatch() {

  }

  render() {

    const statusIcon = () => {
      let iconClass = "#icon-tingzhi";
      if(!this.state.baseInfo.disabled) {
        iconClass = "#icon-yunhang";
      }
      return iconClass;
    }

    return (
      <div style={styles.infoColumn}>
        <h5 style={styles.infoColumnTitle}>状态<IconSvg iconClass={statusIcon()} style={{ margin: '0 10px' }} /></h5>
        <div style={{padding: '20px 0'}}>
          <Row wrap>
            <Col l="2">
              <Button onClick={() => this.onToggleBatch()} 
                type="primary"
                aria-label="prompt button" 
                size="small">
                {this.state.baseInfo.batched ? '开启批处理' : '关闭批处理'}
              </Button>
            </Col>
          </Row>
        </div>
      </div>
    );
  }
}
